<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/06/02
// +----------------------------------------------------------------------

namespace app\erp\validate;

use think\Validate;

/**
 * 公共类 验证器 团购管理
 * @package app\admin\validate
 * @author dou<51779987@qq.com>
 */
class GroupSponsor extends Validate
{
    protected $rule = [
        // 'user_id'	            =>  'require|number',
        'id'		            =>  'require|number|gt:0',
		'tg_title'		        =>  'require',
        'tg_join_num'		    =>  'require|number',
		'tg_start_time'	        =>  'require',
		'tg_end_time'	        =>  'require',
		'tg_status' 		    =>  'require',
		'sku_id' 		        =>  'require',
		'show_price' 		    =>  'require',
		'limit_num' 		    =>  'require|number|gt:0',
		'sp_status' 		    =>  'require',
		'tries' 		        =>  'require|number|gt:0',
		'sum_num' 		        =>  'require|number|gt:0',
		'sorts' 		        =>  'require|number|gt:0',
        'sponsor_id'            =>  'require',
        'store_id'            =>  'require',
    ];

    protected $message  =   [
        'tg_title.require'		        =>  '团购标题不能为空',
        'tg_join_num.require'		    =>  '参团人数不能为空',
        'tg_start_time.require'	        =>  '团购开始时间不能为空',
        'tg_end_time.require'	        =>  '团购结束时间不能为空',
        'tg_status.require' 		    =>  '团购启用状态格式错误',
        'sku_id.require' 		        =>  '参与团购商品不能为空',
        'show_price.require' 		    =>  '展示价格不能为空',
        'limit_num.require' 		    =>  '限购数量不能为空',
        'limit_num.number' 		        =>  '限购数量必须为大于0的整数',
        'sp_status.require' 		    =>  '团购商品启用状态格式错误',
        'tries.require' 		        =>  '购买次数限制不能为空',
        'tries.number' 		            =>  '购买次数限制必须为大于0的整数',
        'sum_num.require' 		        =>  '参与团购总库存数不能为空',
        'sum_num.number' 		        =>  '参与团购总库存数必须为大于0的整数',
        'sorts.require' 		        =>  '排序不能为空',
        'sorts.number' 		            =>  '排序不能为空必须为大于0的整数',
        'sponsor_id' 		            =>  '团购id不能为空',
        'store_id' 		            =>  '门店id不能为空',
    ];

    //验证场景
    protected $scene = [
        'group_banner'=>  [//轮播
            'user_id',
            'store_id',
        ],
        'group_sponsor_sku_list'=>  [//列表
            'user_id',
            'store_id',
        ],
        'group_sponsor_sku_details'=>  [//列表
            'user_id',
            'sponsor_id',
        ],
        'group_sponsor_add'=>  [//添加
            //'user_id',
            'tg_title',
            'tg_join_num',
            'tg_start_time',
            'tg_end_time',
            'tg_status'
        ],
        'group_sponsor_edit'=>  [//修改
            //'user_id',
            'id',
            'show_price',
            'limit_num',
            'tries',
            'sum_num',
        ],
        'group_sponsor_delete'=>  [//删除
            'user_id',
            'id',
        ],
        'group_sponsor_add_sku'=>  [//sku添加
            //'user_id',
            'show_price',
            'limit_num',
            'tries',
            'sum_num',
        ],
        'group_sponsor_edit_sku'=>  [//sku修改
            //'user_id',
            'show_price',
            'limit_num',
            'tries',
            'sum_num',
        ],

    ];
}
